package com.lin.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class DataVO<T> {
    private Integer code;
    private String msg;
    private Long count;
    private List<T> data;


    public static <T> DataVO succ(Integer code, String msg, Long count, List<T> data) {
        DataVO dataVO = new DataVO();
        dataVO.setMsg(msg);
        dataVO.setCode(code);
        dataVO.setCount(count);
        dataVO.setData(data);
        return dataVO;
    }

    public static <T> DataVO adminSuccess(Long count, List<T> data) {
        return succ(0, "操作成功", count,data);
    }

    public static <T> DataVO succ(String msg) {
        return succ(0, msg, null, null);
    }

}
